#pragma once
#include "Game/Process/RenderProcess.h"
#include "Render/Tradition/ComputePipeline.h"
#include "Render/Shader/RHIDescriptor.h"
#include "Render/Tradition/RHIFramebuffer.h"
#include "../LocalEntity.h"
#include "../LocalShader.h"
#include "../ResourceProcess.h"
#include "../LocalScene.h"


class ReflectionsRayTraceProcess : public RenderProcess
{
	DECLARE_PROCESS(ReflectionsRayTraceProcess)

	struct PushConstants
	{
		float bias;
		float trim;
		uint32 frame;
		int32 sampleGi;
		int32 approximateWithDdgi;
		float giIntensity;
		float roughDdgiIntensity;
		float iblIndirectSpecularIntensity;
	};

public:

	bool mSampleGi;

	bool mApproximateWithDdgi;

	PushConstants mPushConstants;

protected:

	virtual void OnInit() override;

	virtual void OnTick(float deltaTime) override;

	virtual void OnResize() override;

protected:

	LocalScene* mLocalScene;

	ResourceProcess* mResourceProcess;



	RefCountPtr<RHITexture> mColorImage;



	ShaderPtr<ReflectionsRayTraceRgenShader> mRgenShader;

	ShaderPtr<ReflectionsRayTraceRchitShader> mRchitShader;

	ShaderPtr<ReflectionsRayTraceRmissShader> mRmissShader;




	RefCountPtr<RHIDescriptor> mDescriptor;

	DescriptorMask mDescriptorMask;
	
	std::array<DescriptorMask, 2> mGBufferDescriptorMask;

	std::array<DescriptorMask, 2> mDdgiDescriptorMask;



	RefCountPtr<RayTracingPipeline> mPipeline;

};
